import java.util.Scanner;

/**
 * 
 */

/**
 * @author zhongfang
 *
 */
public class BalanceNum {

	// 通过率为70，可能是因为大数字问题-->将乘法改为加法
	// 额，修改了log之后，还是只通过80
	public boolean isBalanceNum(String num) {// 从头部尾部两边遍历
		int i = 0;
		int j = num.length() - 1;
		double leftMul = 0;
		double rightMul = 0;
		boolean leftZero = false;
		boolean rightZero = false;
		while (i <= j) {
			if (leftZero) {
				while (i <= j) {
					int rightNum = Integer.parseInt(num.substring(j, j + 1));
					if (rightNum == 0)
						return true;
					j--;
				}
			} else if (rightZero) {
				while (i <= j) {
					int leftNum = Integer.parseInt(num.substring(i, i + 1));
					if (leftNum == 0)
						return true;
					i++;
				}
			} else {
				if (leftMul - rightMul == 0) {
					int leftNum = Integer.parseInt(num.substring(i, i + 1));
					if (leftNum == 0) {
						leftMul = 0;
						leftZero = true;
					} else
						leftMul += Math.log(leftNum);
					int rightNum = Integer.parseInt(num.substring(j, j + 1));
					if (rightNum == 0) {
						rightMul = 0;
						rightZero = true;
					} else {
						rightMul += Math.log(rightNum);
					}
					i++;
					j--;
				} else if (leftMul > rightMul) {
					int rightNum = Integer.parseInt(num.substring(j, j + 1));
					if (rightNum == 0) {
						rightMul = 0;
						rightZero = true;
					} else {
						rightMul += Math.log(rightNum);
					}
					j--;
				} else {
					int leftNum = Integer.parseInt(num.substring(i, i + 1));
					if (leftNum == 0) {
						leftMul = 0;
						leftZero = true;
					} else
						leftMul += Math.log(leftNum);
					i++;
				}
			}
		}
		if (leftZero && rightZero) {
			return true;
		}
		if (!leftZero && !rightZero && leftMul - rightMul == 0) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		BalanceNum balanceNum = new BalanceNum();
		while (in.hasNextLine()) {// 注意while处理多个case
			System.out.println((balanceNum.isBalanceNum(in.nextLine())) ? "YES" : "NO");
		}
	}

}
